<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 1.将模板引擎的库文件引入到当前页面 -->
    <script src="./js/template-web.js"></script>
</head>

<body>
    <div id="container"></div>
    <!-- 2.准备art-template模板 -->
    <script type="text/html" id="tpl">
        <h1>{{username}}{{age}}</h1>
    </script>
    <script type="text/javascript">
        //3.告诉模板引擎将那个数据和哪个模板进行拼接
        var html = template('tpl', {
            username: 'zhangsan',
            age: 20
        });
        document.querySelector('#container').innerHTML = html;
    </script>
</body>

</html>